Skip to content

During compilation, scroll the console to the first error #6081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthijskooijman
Copy link
Collaborator

While adding messages to the console, this keeps track of the position
of the first bit of stderr output. Then, whenever
EditorConsole.scrollDown() is called, the scroll position is changed
so that the line above the first error line is the first one in the
console. If no errors are printed yet, the console scrolls down as
before.

To know what messages are coming from stderr, the ConsoleOutputStream
that generated the message is passed to EditorConsole.insertString(),
though this might not be the best solution for this.

This PR is still a bit of proof-of-concept, especially the extra argument to insertString() doesn't sound like the perfect solution yet. Perhaps the console code should be refactored to be a bit simpler in the first place. But I needed this myself (it will be saving me a lot of time in my current work), so might as well put it up for discussion :-)

While adding messages to the console, this keeps track of the position
of the first bit of stderr output. Then, whenever
`EditorConsole.scrollDown()` is called, the scroll position is changed
so that the line above the first error line is the first one in the
console. If no errors are printed yet, the console scrolls down as
before.

To know what messages are coming from stderr, the ConsoleOutputStream
that generated the message is passed to `EditorConsole.insertString()`,
though this might not be the best solution for this.
@matthijskooijman matthijskooijman added the in progress Work on this item is in progress label Mar 16, 2017
@facchinm
Copy link
Member

The intention looks very good, but it seems that the console doesn't scroll anymore if there is no error but only warnings. This probably happens because everything from stderr is interpreted as en error (I have lots of warnings about broken libs etc at the very beginning of the compilation output)

@matthijskooijman
Copy link
Collaborator Author

Yeah, that's a tricky thing. Currently, the error regex matching happens in a completely separate part of the code, which I couldn't easily connect to the scrolling code. Also, I'm not sure if skipping warnings is really wanted, especial compiler warnings are usually relevant.

@matthijskooijman
Copy link
Collaborator Author

This also interacts badly with avrdude uploading, since that outputs all of its output on stderr, so when compilation is successful, it sticks around the top of the avrdude output without scrolling on to the progress bar. To properly implement this, I think arduino-builder should output more structured info segmenting the stdout and stderr output per command run, and communicating the first failed command, so the IDE can scroll to the output of that failed command, or something like that.

On additional problem is that if you manually scroll down, the current code continues to scroll back up until compilation is complete.

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Work on this item is in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants